package frame.laxcen.test;

import frame.laxcen.request.Request_0010_11;
import frame.laxcen.response.Response_0010_11;
import frame.laxcen.module.RFIDWriter;
import tcpclient.v2.RFIDClient;
import frame.util.Ref;

import java.io.IOException;
import java.net.InetSocketAddress;

public class RFIDWriter_Write_Match_Tid {

    public static void main(String[] args) throws IOException {

        RFIDWriter writer = new RFIDWriter(new RFIDClient(1 << 20, 1024));

        if(writer.tryConnect(new InetSocketAddress("192.168.1.116", 9090))) {

            System.out.println("连接成功！");

            Request_0010_11.RequestTemplate template = new Request_0010_11.RequestTemplate();

            template.useAntenna_1();

            template.standerSingleWrite("1234567890123456");

            template.matchTid("e28011052000725bbd180919");

            System.out.println("发送写指令！");

            Ref<Response_0010_11> writeResult = writer.write(new Request_0010_11(template), 3000);

            System.out.println("写入结果：");

            if(writeResult.isPresent()) System.out.println(writeResult.get().getDataObject().getResult());

            if(writer.tryClose()) System.out.println("关闭连接!");
        }
    }
}
